3D Graphics Programming with QuickDraw 3D 1.5.4

Previous | QD3D Book | Overview | Chapter Contents | Next

Converting Dimensions of Points and Vectors

QuickDraw 3D provides routines that you can use to convert a point or vector of a given dimension to another dimension. When the given dimension is less than the result dimension, the last component is set to 1.0. When the given dimension is greater than the result dimension, each component in the result structure is set to its corresponding component in the given structure divided by the last component.

You must already have allocated space for the result structure before attempting to convert the dimension of a point or vector.

Q3Point2D_To3D

You can use the Q3Point2D_To3D function to convert a two-dimensional point to a three-dimensional point.

TQ3Point3D *Q3Point2D_To3D (
                     const TQ3Point2D *point2D,
                     TQ3Point3D *result);
point2D
A two-dimensional point.
result
On exit, a three-dimensional point.

DESCRIPTION

The Q3Point2D_To3D function returns, as its function result and in the result parameter, the three-dimensional point that corresponds to the two-dimensional point point2D .

Q3Point3D_To4D

You can use the Q3Point3D_To4D function to convert a three-dimensional point to a four-dimensional point.

TQ3RationalPoint4D *Q3Point3D_To4D (
                     const TQ3Point3D *point3D,
                     TQ3RationalPoint4D *result);
point3D
A three-dimensional point.
result
On exit, a rational four-dimensional point.

DESCRIPTION

The Q3Point3D_To4D function returns, as its function result and in the result parameter, the rational four-dimensional point that corresponds to the three-dimensional point point3D .

Q3RationalPoint3D_To2D

You can use the Q3RationalPoint3D_To2D function to convert a three-dimensional rational point to a two-dimensional point.

TQ3Point2D *Q3RationalPoint3D_To2D (
                     const TQ3RationalPoint3D *point3D,
                     TQ3Point2D *result);
point3D
A rational three-dimensional point.
result
On exit, a two-dimensional point.

DESCRIPTION

The Q3RationalPoint3D_To2D function returns, as its function result and in the result parameter, the two-dimensional point that corresponds to the rational three-dimensional point point3D .

Q3RationalPoint4D_To3D

You can use the Q3RationalPoint4D_To3D function to convert a four-dimensional rational point to a three-dimensional point.

TQ3Point3D *Q3RationalPoint4D_To3D (
                     const TQ3RationalPoint4D *point4D,
                     TQ3Point3D *result);
point4D
A rational four-dimensional point.
result
On exit, a three-dimensional point.

DESCRIPTION

The Q3RationalPoint4D_To3D function returns, as its function result and in the result parameter, the three-dimensional point that corresponds to the rational four-dimensional point point4D .

Q3Vector2D_To3D

You can use the Q3Vector2D_To3D function to convert a two-dimensional vector to a three-dimensional vector.

TQ3Vector3D *Q3Vector2D_To3D (
                     const TQ3Vector2D *vector2D,
                     TQ3Vector3D *result);
vector2D
A two-dimensional vector.
result
On exit, a three-dimensional vector.

DESCRIPTION

The Q3Vector2D_To3D function returns, as its function result and in the result parameter, the three-dimensional vector that corresponds to the two-dimensional vector vector2D .

Q3Vector3D_To2D

You can use the Q3Vector3D_To2D function to convert a three-dimensional vector to a two-dimensional vector.

TQ3Vector2D *Q3Vector3D_To2D (
                     const TQ3Vector3D *vector3D,
                     TQ3Vector2D *result);
vector3D
A three-dimensional vector.
result
On exit, a two-dimensional vector.

DESCRIPTION

The Q3Vector3D_To2D function returns, as its function result and in the result parameter, the two-dimensional vector that corresponds to the three-dimensional vector vector3D .


© 1997 Apple Computer, Inc.

Previous | QD3D Book | Overview | Chapter Contents | Next